package digui;

public class Fibo5 {
    /**
     * 公式法
     * @param n
     * @return
     */
    static int fibo5(int n){
        double c=Math.sqrt(5);
        return (int)((Math.pow((1+c)/2,n )-Math.pow((1-c)/2,n ))/c);
    }

    public static void main(String[] args) {
        System.out.println(fibo5(3));
        System.out.println(fibo5(4));
        System.out.println(fibo5(5));
        System.out.println(fibo5(6));
        System.out.println(fibo5(7));
        System.out.println(fibo5(8));
    }
}
